import Toast from '@vant/weapp/toast/toast';
import userApi from '../../api/user'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    userInfo: null,
    // 控制弹出框的显示与隐藏
    show: false,
    avatarUrl: '',
    nickName: '',
    number: '',
    isLogin: false,
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },
  onShow() {
    this.setData({
      userInfo: wx.getStorageSync('user')
    })
    this.userInfo = wx.getStorageSync('user')
    if (this.userInfo) {
      this.setData({
        isLogin: true,
        nickName: this.userInfo.nickname,
        avatarUrl: this.userInfo.avatarUrl,
        number: this.userInfo.number
      })
    } else {
      this.setData({
        isLogin: false
      })
    }
  },
  gotoCheckInfo(){
    wx.navigateTo({
      url: '/pages/checkInfo/index',
    })
  },
  exitLogin() {
    this.setData({
      show: true
    })
  },
  onClose() {
    this.setData({
      show: false
    });
  },
  editPersonInfo() {
    wx.navigateTo({
      url: '../profile/person-info/index',
    })
  }
})